<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title><s:text name="system.page.title"/></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-1.8.0.js" charset="utf-8"></script>
<script type="text/javascript" src="js/ready.js" charset="utf-8"></script>
<script type="text/javascript" src="js/win.js" charset="utf-8"></script>
<script type="text/javascript" src="js/base.js" charset="utf-8"></script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function trClick(id) {
		$("#project_kpi_id").val(id);
	}
	function saveProjeckpi() {
		$.openWin({iframe:true,id:"kpiWin",width:600,height:500,action:"treeProjectKpiSelect.do",title:"添加指标"});
	}
	function disenbleProjeckpi() {
		var id = $("#project_kpi_id").val();
		if(id != "") {
			if(confirm("<s:text name='system.rec.del'/>")) {				
				formId.action = "deleteProjeckpi.do";
				formId.submit();
			}
		} else {
			alert("<s:text name='system.rec.select'/>");
		}
	}
	function settingKpi(kpiId) {
		if(kpiId == "") {
			alert("<s:text name='system.rec.select.kpi'/>");
		} else {
			$.closeWin("kpiWin");
			$("#kpiIds").val(kpiId);
			formId.action="editorProjeckpi.do";
			formId.submit();
		}
	}
	function changeSource(o, id) {
		var s = $(o).val();
		$.post("changeSource.do", {"bean.project_kpi_id":id,"bean.source":s});
	}
</script>
</head>
<body>
<div class="tools">
	<div class="tool">
	<ul>
		<li>
			<div onclick="saveProjeckpi();"><img src="image/button/NEW20.gif"/><span><s:text name='system.button.new'/></span></div>
		</li>
		<li>
			<div onclick="disenbleProjeckpi();"><img src="image/button/DEL20.gif"/><span><s:text name='system.button.disenbale'/></span></div>
		</li>
	</ul>
	</div>
</div>
<form action="" method="post" id="formId" name="formId">
<input type="hidden" name="bean.project_kpi_id" id="project_kpi_id">
<s:hidden name="pageBean.currentPage" id="currentPage"/>
<s:hidden name="bean.project_id" id="project_id"/>
<input type="hidden" name="bean.kpi_ids" id="kpiIds">
<div class="tabledata" style="overflow-y: auto;">
	<table border="0" cellpadding="0" cellspacing="0" width="100%" class="listtable">
		<tr class="trhead">
			<td style="width:15px"></td>
			<td><s:text name='rec.projeckpi.kpi_num'/></td>
			<td><s:text name='rec.projeckpi.kpi_name'/></td>
			<td><s:text name='rec.projeckpi.source'/></td>
			<td><s:text name='rec.projeckpi.disable'/></td>
		</tr>
		<s:set name="seq" value="pageBean.startRow + 1" />
		<s:set name="start" value="#seq"/>
		<s:iterator value="list" id="l">
		<tr <s:if test="#seq%2==0">class="trodd"</s:if><s:else>class="treven"</s:else> trclikc="trClick(<s:property value="#l.project_kpi_id"/>)" >
			<td style="width:15px"><img alt="extend" src="image/button/datagrid_row_expand.gif" onclick="extendRow(this, '<s:property value="#l.kpi_num"/>');"/></td>
			<td><s:property value="#l.kpi_num"/></td>
			<td><s:property value="#l.kpi_name"/></td>
			<td>
				<div>
				<input type="text" name="source" value="<s:property value="#l.source"/>" onchange="changeSource(this, <s:property value="#l.project_kpi_id"/>)">
				</div>
			</td>
			<td><s:property value="#l.disable"/></td>
		</tr>
		<tr>
			<td colspan="5" id="<s:property value="#l.kpi_num"/>"></td>
		</tr>
		<s:set name="seq" value="#seq + 1"/>
		</s:iterator>
		<s:set name="end" value="#seq-1"/>
	</table>
</div>
<div class="page">
	<div class="pagelist" style="width:100%;">
		
	</div>
</div>
</form>
</body>
</html>